package com.iursp.mapper.role;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.iursp.domain.model.role.Role;

import tk.mybatis.mapper.common.BaseMapper;

@Mapper
public interface AuthRoleMapper extends BaseMapper<Role>{

	@Select("SELECT refid,platform_refid,role_code,role_name,role_desc,role_row_key,active,deleted,create_user_refid,create_date_time,modify_user_refid,modify_date_time FROM auth_role \r\n" + 
			"		 WHERE active = true\r\n" + 
			"		   AND deleted = false")
	List<Role> queryAllRole();

	
	@Select("SELECT c.* FROM common_user a\r\n" + 
			"	LEFT JOIN auth_user_role b ON a.refid = b.user_refid\r\n" + 
			"	LEFT JOIN auth_role c on b.role_row_key = c.role_row_key\r\n" + 
			"	WHERE a.refid = #{refid}")
	List<Role> selectByUserRefid(@Param("refid")String refid);


}
